home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
codecopy
/
copystop
/
copystop.doc
< prev
next >
Wrap
Text File
|
1995-01-31
|
7KB
|
150 lines
Description
COPYSTOP is a utility which may be called by any Visual Basic 2.0 or 3.0
application using the SHELL keyword. COPYSTOP will return a two digit
code to indicate whether the application is running on the machine on
which it was first installed. The programmer may then take any chosen action
if it is discovered that the application has been copied on to a different
machine. The aim is to provide the Visual Basic developer with a ready
means of discouraging wholesale copying of his/her products.
The COPYSTOP package comprises:
1. The COPYS200.EXE executable module which requires VBRUN200.DLL.
2. The COPYS300.EXE executable module which requires VBRUN300.DLL.
Only one of these modules would be used in a particular application
depending on which version of Visual Basic is in use.
3. Sample code to be included in your VB application to invoke the
COPYSTOP executable and receive the results.
4. An "unlock" utility (UL200.EXE and UL300.EXE) to allow the programmer
to reset the COPYSTOP protection. Without this it would be difficult
to experiment with the procedure during program development.
Method of operation
COPYSTOP works in the following way.
The relevant COPYSn00.EXE executable is distributed with the application and
copied into the same directory as the Visual Basic application during Setup.
Code should be included in the application to run the COPYn00.EXE
using the SHELL keyword (see below). **It is very important not to change
the name of any of the files in the COPYSTOP package**.
The first time that COPYSTOP is called by the application it creates
a hidden file in the root directory of the disc on which it runs. Into
this it inserts a randomly generated identification number (note that
in the unregistered version the hidden file is created in the local
not the root directory.)
During this initial run, the serial number is also recorded in the
COPYSn00.EXE executable code.
On subsequently running the application, the hidden file is accessed and the
serial number is checked. If it matches, an appropriate code is returned to
the application. If the wrong number is found a different code is sent.
If no hidden file is found, as might be the case if the application had
been copied to another machine, a separate descriptive code is sent. These
codes are described in more detail below. The programmer/ developer is free
to formulate his/her own response to these codes.
Once the serial number has been installed during the initial run, COPYSTOP
will only return a favourable code if the same number is found on subsequent
runs. If it does not find the hidden file, COPYSTOP will not create another.
Once run, therefore, the procedure is locked into a fixed expectation of
finding the originally allocated serial number. It is obviously necessary
to provide the developer, who must supply a virgin version of the COPYSTOP
executable with each copy of his application, with a means of resetting
the procedure. An "unlock" utility, ULn00.EXE, is supplied to meet this need.
The role of ULn00.EXE is to delete the hidden security file and to reset
COPYSn00.EXE's memory of having ever created such a file. Be sure only to
use UL200.EXE with COPYS200.EXE and UL300.EXE with COPYS300.EXE, or else
things can get into a twist. Any such twist is usually sorted out by running
the other UL.
In this, unregistered, version a Message Box (pleading for registration!)
is displayed when COPYSTOP is invoked. A version without this feature
is supplied to registered users.
Example code
The following code should be included in your application. An appropriate
place would be at the beginning of the Form_load procedure for the first
form in the application.
The form containing this code should have on it a TextBox to
receive the codes returned by COPYSTOP. This should have the focus i.e. the
box should be visible and the cursor should be flashing in it prior to
issuing the Shell command. The box may be made inconspicuous by making
it very small and setting its visible property to FALSE immediately after
use. Alternatively, you may make use of any other text box which happens
to be present on that form. Assuming this box is called TEXT1 and the
first form in your application is FORM1, the following code is needed.
dim code1 as integer
dim code2 as integer
form1.show
text1.visible =true
text1.setfocus
t=Shell("copys200.exe")
'or t=Shell("copys300.exe") depending on which VB you are using.
check:
If len(text1.text) > 2 then
code1=val(left$ (text1.text,2))
code2=val(right$(text1.text,2))
else
doevents
goto check
endif
text1.visible=false
This loop waits until COPYSTOP responds and then determines the values
of code1 and code2, these have the following meanings.
If code1 is 0, no hidden security file was found.
If code1 is 1, a hidden security file was found.
If code2 is 0, either the wrong serial number was found in the file or,
this is not the first time COPYSTOP has been asked to
create a security file and may, therefore, be running on a
new host.
If code2 is 1, a correct serial number was found in a hidden file or,
this is the first time COPYSTOP has been asked to create
a security file.
Thus, code2=1 is the necessary condition for legal use of the application.
Your application could react to a failure to receive this signal by either
closing down or simply issuing a mild rebuke - its up to you.
---------------------------------------------------------------------------
Registration
Registered users will be sent a version of COPYSTOP without the registration
message box. An appropriate version of the UNLOCK utility is also supplied.
Registered users of COPYSTOP acquire the royalty-free right to distribute
the COPYSTOP executable module as part of ONE bona-fide Visual Basic
application. The UNLOCK executable module may not be passed on to any third
party under any circumstances. Copyright of all COPYSTOP and UNLOCK code and
documentation is retained by me.
Users wishing to register should send £6 (six pounds sterling) or $10 to:
John Crabb
Pax
Bishopswood
CHARD
Somerset TA20 3SD
UK
(queries to email J.A.Crabb@exeter.ac.uk)
I may also send a postcard from rural Somerset!
Developers wishing to use the system with further applications should send
a licence extension fee of £3 or $5 along with the name of the new
application.
----------------------------------------------------------------------------